package com.bee.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bee.user.common.domain.OrgDO;
import com.bee.user.common.vo.OrgVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 组织机构表(Org)表数据库访问层
 *
 * @author makejava
 * @since 2019-11-01 22:18:35
 */
public interface OrgMapper extends BaseMapper<OrgDO> {

    String COLUMN = "id,org_code,org_name,org_short_name,phone,contact,contact_phone,address,enable,create_time,creator,update_time,updator,deleted,delete_time";

    /**
     * 查询所有
     * @return
     */
    @Select({"<script>",
            "select " + COLUMN + " from org ",
            "where 1 = 1",
            "<if test='orgName != null'> and (org_name like CONCAT('%', #{orgName}, '%') or org_short_name like CONCAT('%', #{orgName}, '%')) </if>" ,
            "</script>"})
    List<OrgVO> queryAll(OrgVO orgVO);

}